import {request} from '@/utils/wpp'


// 参数类型看接口文档
export interface TrademarkData {
  id?: number,
  tmName: string,
  logoUrl: string
}

// 返回的数据类型测接口看返回的数据
export type TrademarkListInfoData =
  {
    records: TrademarkData[]
    total: number,
    size: number,
    current: number,
    searchCount: boolean,
    pages: number
  }


export default {
  // DELETE /admin/product/baseTrademark/remove/{id}
  // 删除BaseTrademark
  remove(id: number) {
    return request.delete<any, null>(`/admin/product/baseTrademark/remove/${id}`)
  },

  addOrUpdate(trademark: TrademarkData) {
    // if (trademark.id) {
      return request.put<any, null>('/admin/product/baseTrademark/update', trademark)
    // } else {
    //   return request.post<any, null>('/admin/product/baseTrademark/save', trademark)
    // }
  },

  unData(trademark: TrademarkData){
    return request.post<any, null>('/admin/product/baseTrademark/save', trademark)
  },

  // GET /admin/product/baseTrademark/{page}/{limit}
  getPageListInfo(page: number, limit: number) {
    return request.get<any,TrademarkListInfoData>(`/admin/product/baseTrademark/${page}/${limit}`)
  },

  // 获取所有的列表
  //GET /admin/product/baseTrademark/getTrademarkList
  getList(){
    return request.get<any,TrademarkData[]>('/admin/product/baseTrademark/getTrademarkList')
  }
}